﻿// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_SALES_USER_SCHEDULER
// * CreateDate    : 2012/12/29 12:51:34
// * Creater       : SalesUserSchedulerBs
// * LastChangeDate: 2012/12/29 12:51:34
// * LastChanger   : 2012/12/29 12:51:34
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Sales
{
    /// <summary>
    /// SalesUserScheduler
    /// </summary>
    public partial class SalesUserSchedulerBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objSalesUserSchedulerEntity">Entity</param>
        /// <returns>Entity</returns>
        public static SalesUserSchedulerEntity GetSalesUserScheduler(SalesUserSchedulerEntity objSalesUserSchedulerEntity)
        {
            return DataAccess.SelectSingle<SalesUserSchedulerEntity>(objSalesUserSchedulerEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objSalesUserSchedulerEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertSalesUserScheduler(SalesUserSchedulerEntity objSalesUserSchedulerEntity)
        {
            return DataAccess.Insert(objSalesUserSchedulerEntity);
        }

        public static bool InsertSalesUserScheduler(List<SalesUserSchedulerEntity> objSalesUserSchedulerEntityList)
        {
            return DataAccess.Insert(objSalesUserSchedulerEntityList);
        }
        public static bool InsertSalesUserScheduler(DataTable dt)
        {
            List<SalesUserSchedulerEntity> ScheList=new List<SalesUserSchedulerEntity>();
            foreach (DataRow dr in dt.Rows)
            {
                SalesUserSchedulerEntity entity = new SalesUserSchedulerEntity(dr);
                ScheList.Add(entity);
            }
            return DataAccess.Insert(ScheList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objSalesUserSchedulerEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateSalesUserScheduler(SalesUserSchedulerEntity objSalesUserSchedulerEntity)
        {
            return DataAccess.Update(objSalesUserSchedulerEntity);
        }

        public static bool UpdateSalesUserScheduler(List<SalesUserSchedulerEntity> objSalesUserSchedulerEntityList)
        {
            return DataAccess.Update<SalesUserSchedulerEntity>(objSalesUserSchedulerEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objSalesUserSchedulerEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteSalesUserScheduler(SalesUserSchedulerEntity objSalesUserSchedulerEntity)
        {
            return DataAccess.Delete(objSalesUserSchedulerEntity);
        }

        public static bool DeleteSalesUserScheduler(List<SalesUserSchedulerEntity> objSalesUserSchedulerEntityList)
        {
            return DataAccess.Delete<SalesUserSchedulerEntity>(objSalesUserSchedulerEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetSalesUserSchedulerAll()
        {
            return DataAccess.SelectAllDataSet<SalesUserSchedulerEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<SalesUserSchedulerEntity> GetSalesUserSchedulerAllList()
        {
            return DataAccess.SelectAll<SalesUserSchedulerEntity>();
        }
        #endregion

        #region Functions
        public static DataSet GetSalesUserSchedulerByPersonId(string PersonId)
        {
            string sql = @"select * from SALES_USER_SCHEDULER where PERSON_ID ='" + PersonId + "'";
            DataSet ds = DataAccess.SelectDataSet(sql);
            return ds;
        }
        #endregion
    }


}

